﻿
/// ---------------------------------------------
/// 2012.5.21
/// 汪定新
///
/// ---------------------------------------------

//双击事件
var CustomDbClick = function () {//屏蔽双击事件
    parent.closeWin();
}

//添加到简历类别中
var fnAddResumeType = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请至少选择一条记录");
        return;
    }
    //获取添加到简历类别的人员
    var list = this.mDataTable.getRecordSet()._records;
    var listId = [];
    for (var i = 0; i < list.length; i++) {  //获取选择项
        if (list[i]._oData["iSun_Selected"] == true) {
            listId.push(list[i]._oData[const_entityID]);
        }
    }
    var tempId = "";
    if (listId.length > 0) { //选中checkbox
        for (var j = 0; j < listId.length; j++) {
            if (j == listId.length - 1) {
                tempId = tempId + listId[j];
            }
            else {
                tempId = tempId + listId[j] + "_";
            }
        }
    }
    else {  //未选中checkbox,获取当前选中单行
        tempId = record.getData(const_entityID);
    }
    document.getElementById("dialog1_h").innerHTML = "添加到简历类别";
    document.getElementById("EditUIWindow").src = "../EHR/hrAddToResumeType.aspx?id=" + tempId;
    SetDWH(400, 300, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}


//添加
var fnCustomAdd = function () {
    document.getElementById("EditUIWindow").src = "../EHR/hrUploadResume.aspx";
    SetDWH(500, 350, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
    //var k = window.showModalDialog("../EHR/hrUploadResume.aspx", window, "dialogWidth=450px;dialogHeight=300px;status=no;help=no;scroll=yes");
}
//编辑
var fnCustomEdit = function () {
    alert("不允许修改!");
    return;
}

//删除第一步
var fnCustomDelete = function () {
    //第一步
    const_EditEntity = 'hrCandidate';
    var list = this.mDataTable.getRecordSet()._records;
    var elist = [];
    dl = [];
    for (var i = 0; i < list.length; i++) {
        //this.getRecordSet()._records[0]._oData["BarItem"]
        if (list[i]._oData["iSun_Selected"] == true) {
            elist.push(list[i]._oData[const_entityID]);
            dl.push(list[i]._sId); //获取行ID；
        }
    }
    if (elist.length == 0) {
        var recordID = myDataTable.getSelectedRows()[0];
        record = myDataTable.getRecord(recordID);
        if (editpageFlag == 0) {
            SaveUrl = "AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID);
        } else {
            SaveUrl = "AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&table=" + const_EditEntity + "&id=" + record.getData(const_entityID);
        }
    }
    else {
        if (editpageFlag == 0) {
            SaveUrl = "AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&entity=" + const_EditEntity + "&json=" + elist.join(",");
        }
        else {
            SaveUrl = "AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&table=" + const_EditEntity + "&json=" + elist.join(",");
        }
    }
    YAHOO.example.container.dialog3.show();

}

//页面加载时
if (typeof ($) != "undefined") {
    $(document).ready(function () {

    });
}
//数据验证
var fnCheckData = function () {

}